#include "../func.h"

void sig(int signum, siginfo_t* p, void* p1)
{
    printf("%d signum is coming\n", signum);
}

int main()
{
    struct sigaction act;
    memset(&act, 0, sizeof(act));
    act.sa_sigaction = sig;
    //act.sa_flags = SA_SIGINFO|SA_RESTART;
    act.sa_flags = SA_SIGINFO;
    int ret;
    ret = sigaction(SIGINT, &act, NULL);
    if (-1 == ret)
    {
        perror("sigaction");
        return -1;
    }
    char buf[10] = {0};
    read(0, buf, sizeof(buf));
    printf("buf=%s\n", buf);
    return 0;
}
